function searchForm(){
	 document.indexForm.submit();
}

function trim(val)
 {
 
	return val.replace(/(\s*$)/g, "");  
	
}
 

function selectAll(){
	var checkall = document.getElementById('checkall');
	var listsize = document.getElementById('listsize').value;
	for(var i=0;i<listsize;i++){
		if(checkall.checked){
			document.getElementById('checkone'+i).checked = true;
		}else{
			document.getElementById('checkone'+i).checked = false;
		}
	}
}





function subForm(){
	
	if(document.getElementById("cat_name")==null || trim(document.getElementById("cat_name").value)=="")
	{
	  alert("分类名称不能为空！");
	  document.getElementById("cat_name").focus;
	  return false;
	}
 
   document.addForm.submit();
}

 function sortNews(val)
 {
    var elem=val.form.elements;
    var all_news_text='';
    for(i=0;i<elem.length;i++)
    {
        if(elem[i].type=="text" && elem[i].id!="s_title")
        {
      	   all_news_text +=elem[i].id+','+elem[i].value+'|';
        }
    }
 
    document.indexForm.action='/doTradeReg.do';
    document.getElementById("sort").value=all_news_text;
    document.getElementById("bpm_id").value='9535';
    document.indexForm.submit();
 }
 
 
 
 function delNewsInfo(){
 
 	var listsize = document.getElementById('listsize').value;
	var pkid_string = '';
 
	var down_class='0';
	for(var i=0;i<listsize;i++){
		if(document.getElementById('checkone'+i).checked){
			pkid_string += document.getElementById('checkone'+i).value+'|';
 
		  var ifdown= document.getElementById('hasdown'+i);
			if(ifdown !=null && ifdown.value=='1')
			{
			   down_class =1;
			}	
			
		}
	}
	if(pkid_string == ''){
		alert('请至少选择一条!');
		return false;
	}
	document.getElementById('pkid').value = pkid_string;
	document.indexForm.action='/doTradeReg.do';
 
  
  if(down_class == 1)
  {
		  if(confirm("所选中含有下级分类，删除时下级分类也会一并删除！"))
		  {
		    document.indexForm.submit();
	    }
	} 
	else 
	{
		 if(window.confirm('确认删除吗?'))
		 {
		   document.indexForm.submit();
	   }
	}	
}

function delOneNews(val1,val2){
	
	  var ifdown= document.getElementById('hasdown'+val1);
		
		if(ifdown !=null && ifdown.value=='1')
		{
			if(confirm("所选中含有下级分类，删除时下级分类也会一并删除！"))
		  {
		     window.location.href='/doTradeReg.do?pkid='+val2+'&bpm_id=3694';
	    }		
	  }	
		else	 
		{ 
        if(window.confirm('确认删除吗?')
)
        {
       	  window.location.href='/doTradeReg.do?pkid='+val2+'&bpm_id=3694'; 
        } 		
    }
	
}

function ignoreSpaces(string) {
		var temp = "";
		string = '' + string;
		splitstring = string.split(" ");
		for(i = 0; i < splitstring.length; i++)
		temp += splitstring[i];
		return temp;
}

function   clearSBC(){ 
window.clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,'')) 
} 